package com.android.tea;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class LoginActivity extends Activity implements OnClickListener {
	private EditText passwordEdit;
	private EditText accountEdit;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.login);

		initComponents();
	}

	private void initComponents() {
		Button back = (Button) findViewById(R.id.btn_back);
		back.setOnClickListener(this);
		Button register = (Button) findViewById(R.id.btn_reg);
		register.setOnClickListener(this);

		accountEdit = (EditText) findViewById(R.id.edit_account);
		passwordEdit = (EditText) findViewById(R.id.edit_password);
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.btn_back:
			super.onBackPressed();
			break;
		case R.id.btn_reg:
			Intent intent = new Intent(this,RegActivity.class);
			startActivity(intent);
			break;
		case R.id.login:
			//
			String account = accountEdit.getText().toString();
			String password = passwordEdit.getText().toString();
			// 简单的校验 用户名和密码

			// 执行登录流程
			break;

		default:
			break;
		}
	}
}
